<template>   <el-menu router
          :default-active="$route.path"
          class="el-menu-vertical-demo"
          unique-opened
        >
        
      <div v-for="(item,index) in meanuList" :key="item.path">

         <el-submenu v-if="item.meta.level==2" :index="item.path">
          <template slot="title">
            <i :class="['iconfont',item.meta.icon]"></i>
            <span>{{item.meta.title}}</span>
          </template>
            <el-menu-item-group v-for="(obj,index) in item.children" :key="obj.path" >
              <el-menu-item :index="item.path+'/'+obj.path">{{obj.meta.title}}</el-menu-item>
            </el-menu-item-group>
          </el-submenu>

           <el-menu-item v-else  :index="item.path">
            <i :class="['iconfont',item.meta.icon]"></i>
            <span slot="title">{{item.meta.title}}</span>
          </el-menu-item>
      </div>
  
  <!-- 
          <el-menu-item index="/home">
            <i class="el-icon-menu"></i>
            <span slot="title">后台首页</span>
          </el-menu-item>
  
          <el-menu-item index="/order/list">
            <i class="el-icon-menu"></i>
            <span slot="title">订单管理</span>
          </el-menu-item>
  
           <el-submenu index="/goods">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>商品管理</span>
          </template>
            <el-menu-item index="/goods/list">商品列表</el-menu-item>
            <el-menu-item index="/goods/save">添加商品</el-menu-item>
            <el-menu-item index="/goods/goodstype">添加类别</el-menu-item>
          </el-menu-item-group>
         
        </el-submenu>
  
          <el-menu-item index="/shop">
            <i class="el-icon-setting"></i>
            <span slot="title">店铺管理</span>
          </el-menu-item>
  
  <el-submenu index="/users">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>账号管理</span>
          </template>
            <el-menu-item index="/users/list">账号列表</el-menu-item>
            <el-menu-item index="/users/save">添加账号</el-menu-item>
            <el-menu-item index="/users/userpwd">修改密码</el-menu-item>
            <el-menu-item index="/users/personal">个人中心</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
  
  
  
  <el-submenu index="/census">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>统计管理</span>
          </template>
            <el-menu-item index="/census/goods">商品列表</el-menu-item>
            <el-menu-item index="/census/order">订单列表</el-menu-item>
          </el-menu-item-group>
        </el-submenu> -->
        </el-menu>
</template>

<script>
export default {
  data() {
    return {
      meanuList: [],
    };
  },
  mounted() {
    this.meanuList = this.$local.get("menuList");
    console.log(this.meanuList);
  },
};
</script>

<style lang="less" scoped>
</style>